package com.qianying.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qianying.entity.OrderStatus;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 订单状态Mapper接口
 */
@Mapper
public interface OrderStatusMapper extends BaseMapper<OrderStatus> {

    /**
     * 分页查询订单状态
     */
    @Select("SELECT * FROM order_status ${ew.customSqlSegment}")
    IPage<OrderStatus> selectPage(Page<OrderStatus> page, @Param(Constants.WRAPPER) Wrapper<OrderStatus> queryWrapper);

    /**
     * 根据状态名称查询
     */
    @Select("SELECT * FROM order_status WHERE status_name = #{statusName}")
    OrderStatus selectByName(String statusName);

    /**
     * 根据状态代号查询
     */
    @Select("SELECT * FROM order_status WHERE status_code = #{statusCode}")
    OrderStatus selectByCode(String statusCode);
}
